package com.sairobo.admin.modules.srblive.manager.impl;

import java.util.Arrays;
import java.util.List;

import java.util.HashMap;
import java.util.Map;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sairobo.base.common.entity.Page;
import org.springframework.stereotype.Component;

import com.sairobo.base.common.constant.QueryConts;
import com.sairobo.base.common.entity.Query;
import com.sairobo.admin.modules.srblive.dao.SrbliveLiveroomparenttypeMapper;
import com.sairobo.admin.modules.srblive.entity.SrbliveLiveroomparenttype;
import com.sairobo.admin.modules.srblive.manager.SrbliveLiveroomparenttypeManager;

/**
 * 直播间父类型
 *
 * @author admin
 * @email sairobo
 * @url www.sairobo.com
 * @date 2018年1月11日 下午7:52:34
 */
@Component("srbliveLiveroomparenttypeManager")
public class SrbliveLiveroomparenttypeManagerImpl extends ServiceImpl<SrbliveLiveroomparenttypeMapper,SrbliveLiveroomparenttype> implements SrbliveLiveroomparenttypeManager {
    
	@Override
	public List<SrbliveLiveroomparenttype> listSrbliveLiveroomparenttype(Page<SrbliveLiveroomparenttype> page, Query search) {
        EntityWrapper<SrbliveLiveroomparenttype> ew=new EntityWrapper<SrbliveLiveroomparenttype>();
        //搜索条件
        Map map = (HashMap)search.get(QueryConts.SEARCH_KEYWORD);
        ew.like(true,"name",(String) map.get("key"));
        //ew.eq(false,"XXX",(String) map.get("key"));
        ew.orderBy("id",false);
        //ew.orderBy("create_time",false);
        return baseMapper.selectPage(page,ew);
	}

	@Override
	public int saveSrbliveLiveroomparenttype(SrbliveLiveroomparenttype srbliveLiveroomparenttype) {
        return baseMapper.insert(srbliveLiveroomparenttype);
	}

	@Override
	public SrbliveLiveroomparenttype getSrbliveLiveroomparenttypeById(Long id) {
        SrbliveLiveroomparenttype test = baseMapper.selectById(id);
        return test;
	}

	@Override
	public int updateSrbliveLiveroomparenttype(SrbliveLiveroomparenttype srbliveLiveroomparenttype) {
        return baseMapper.updateById(srbliveLiveroomparenttype);
	}

	@Override
	public int batchRemove(Long[] id) {
        int count = baseMapper.deleteBatchIds(Arrays.asList(id));
        return count;
	}
	
}
